home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Internet Info 1994 March
/
Internet Info CD-ROM (Walnut Creek) (March 1994).iso
/
networking
/
ip
/
ka9q
/
net_des.arc
/
DESTEST.C
< prev
next >
Wrap
C/C++ Source or Header
|
1988-12-05
|
614b
|
41 lines
#include <stdio.h>
main()
{
char key[8],work[8];
desinit();
printf("Ready\n");
get8(key);
printf("Setting key: "); put8(key); printf("\n");
setkey(key);
printf("Key set\n");
while(!feof(stdin)){
get8(work);
printf("Plain: "); put8(work); printf("\n");
endes(work);
printf("Cipher: "); put8(work); printf("\n");
dedes(work);
printf("Decrypted: "); put8(work); printf("\n");
}
}
get8(cp)
char *cp;
{
int i,t;
for(i=0;i<8;i++){
scanf("%2x",&t);
*cp++ = t;
}
}
put8(cp)
char *cp;
{
int i;
for(i=0;i<8;i++){
printf("%02x ",*cp++ & 0xff);
}
}